********************************************************************************
* appendix table 10: near near migration robustness, log(origin income)

********************************************************************************

* NO PIONEER 
use mig_analysis_file_no_pioneer , clear

reghdfe log_inc treated_after /// 
	if tx_1==0 & origin_student<.2 & inrange(move_year,2011,2017)>0 & building_sample==1 & min_number>0  ///
	[aweight=building_sample_weight],absorb(msa_year building_id) vce(cl building_id)

capture drop building_tag
egen building_tag=tag(building_id)
tab treated if building_tag==1 & building_sample==1 & min_number>0

* LOW COLLEGE
use mig_analysis_file_201458_250_all, clear

preserve

keep if building_pct_college<.4

reghdfe log_inc treated_after /// 
	if tx_1==0 & origin_student<.2 & inrange(move_year,2011,2017)>0 & building_sample==1 & min_number>0  ///
	[aweight=building_sample_weight],absorb(msa_year building_id) vce(cl building_id)

capture drop building_tag
egen building_tag=tag(building_id)
tab treated if building_tag==1 & building_sample==1 & min_number>0	

restore
		
* LOW WHITE
preserve

keep if building_pct_white<.5

reghdfe log_inc treated_after /// 
	if tx_1==0 & origin_student<.2 & inrange(move_year,2011,2017)>0 & building_sample==1 & min_number>0  ///
	[aweight=building_sample_weight],absorb(msa_year building_id) vce(cl building_id)
capture drop building_tag
egen building_tag=tag(building_id)
tab treated if building_tag==1 & building_sample==1 & min_number>0	

restore
	
* LOWER INCOME 
preserve

gen alt_g=0
replace alt_g = 1 if msa=="atlanta" & building_med_hh_inc<56000
replace alt_g = 1 if msa=="austin" & building_med_hh_inc<64000
replace alt_g = 1 if msa=="chicago" & building_med_hh_inc<59000
replace alt_g = 1 if msa=="denver" & building_med_hh_inc<67000
replace alt_g = 1 if msa=="la" & building_med_hh_inc<60000
replace alt_g = 1 if msa=="brooklyn" & building_med_hh_inc<66000
replace alt_g = 1 if msa=="philadelphia" & building_med_hh_inc<59000
replace alt_g = 1 if msa=="portland" & building_med_hh_inc<62000
replace alt_g = 1 if msa=="sf" & building_med_hh_inc<86000
replace alt_g = 1 if msa=="seattle" & building_med_hh_inc<73000
replace alt_g = 1 if msa=="dc" & building_med_hh_inc<73000

keep if alt_g==1

reghdfe log_inc treated_after /// 
	if tx_1==0 & origin_student<.2 & inrange(move_year,2011,2017)>0 & building_sample==1 & min_number>0  ///
	[aweight=building_sample_weight],absorb(msa_year building_id) vce(cl building_id)

capture drop building_tag
egen building_tag=tag(building_id)
tab treated if building_tag==1 & building_sample==1 & min_number>0	

restore	
	
* NO NEW YORK 
preserve

drop if msa=="brooklyn"

reghdfe log_inc treated_after /// 
	if tx_1==0 & origin_student<.2 & inrange(move_year,2011,2017)>0 & building_sample==1 & min_number>0  ///
	[aweight=building_sample_weight],absorb(msa_year building_id) vce(cl building_id)

capture drop building_tag
egen building_tag=tag(building_id)
tab treated if building_tag==1 & building_sample==1 & min_number>0	

restore	
